#ifndef __ARENA_H__
#define __ARENA_H__

#include <stddef.h>

typedef struct arena
{
    struct memblock
    {
        struct memblock* next;
        size_t size;
    } *blocks;
    char* currpos;
    char* end;
    size_t blocksize;
    int malloced;
} arena_t;

arena_t* arena_create(size_t blocksize);
arena_t* arena_create_static(void* buf, size_t bufsize);
void* arena_malloc(arena_t* a, size_t size);
void arena_reset(arena_t* a);
void arena_destroy(arena_t* a);

#endif /* __ARENA_H__ */
